package com.hospital.doctor.service;


import com.auth0.jwt.interfaces.Claim;
import com.hospital.doctor.mapper.PatientMapper;
import com.hospital.doctor.pojo.Patient;
import com.hospital.doctor.utils.NoEmpty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class PatientServiceImpl implements PatientService {

    @Autowired
    private PatientMapper patientMapper;


    @Override
    public List<Patient> selectAll(Patient patient) {

        return patientMapper.selectAll(patient);
    }

    @Override
    public Patient selectById(int id) {
        return patientMapper.selectById(id);
    }

    @Override
    public int updateById(Patient patient) {
        return patientMapper.updateById(patient);
    }

    @Override
    public List<Patient> selectByName(String pName) {
        String s = pName.replaceAll("\\s*", "");
        List<Patient> patients = patientMapper.selectByName(s);
        return patientMapper.selectByName(pName);

    }

    @Override
    public int updateOutTime(int pId) {
        return patientMapper.updateOutTime(pId);
    }


}
